var ibMarketIcons = {
	dropdownInput: $H(),
	
	/*------------------------------*/
	/* Constructor 					*/
	init: function()
	{
		Debug.write("Initializing icons.js");
	},
	register: function(dropdownId)
	{
		Debug.write('ibMarket icon dropdown' + dropdownId);
		
		this.dropdownInput[dropdownId] = $(dropdownId);
		this.dropdownInput[dropdownId].image  = $(dropdownId+'_icon');
		
		this.dropdownInput[dropdownId].observe('change', this.changeValue.bindAsEventListener( this ));
		this.dropdownInput[dropdownId].observe('keyup', this.changeValue.bindAsEventListener( this ));
		
		this.changeIcon(dropdownId);
	},
	changeValue: function(event)
	{
		this.changeIcon(event.element().identify());
	},
	changeIcon: function(dropdownId)
	{
		var iconLocation = $(dropdownId).getValue();
		this.dropdownInput[dropdownId].image.src = ipb.vars['market_images_url']+"/icons/"+iconLocation;
	}
}

ibMarketIcons.init();